package cn.sppxpp.config;

import cn.sppxpp.pojo.DingTalk;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

/**
 * @author ShouPeng
 * @date 2020-12-19 21:02
 * @email 7698627@qq.com
 **/
public class configUtil {

    /**
     * 读取配置文件
     * @return
     */
    public static DingTalk readConfig() throws IOException {
        //获取根路径
        String rootPath = configUtil.class.getResource("/").getPath();
        Properties properties = new Properties();
        properties.load(new FileReader(rootPath + "app.properties"));
        DingTalk talk = new DingTalk();
        talk.setAppId(properties.get("appId"));
        talk.setAppSecret(properties.get("appSecret"));
        return talk;
    }

}
